<template>
	<nav-header title="编辑评论">
		<view class="bg-white p-3">
			<u-textarea v-model="content" placeholder="请填写评论内容..." 
				height="200" border="none" maxlength="200" count></u-textarea>
		</view>
		<view class="bg-theme w-full py-4 flex items-center justify-around fixed bottom-0 z-50 text-white" @click="submit">发表评论</view>
	</nav-header>
</template>

<script>
	import NavHeader from '@/components/nav_header.vue'
	import * as activityApi from "@/interface/junchuang/activity.js"
	export default {
		components: {
			NavHeader
		},
		data() {
			const v = this
			return {
				actId: '',
				replyId: '',
				content: ''
			}
		},
		onLoad(e) {
			this.actId = e.actId
			if (e.replyId) this.replyId = e.replyId
		},
		methods: {
			submit() {
				if (!this.content) {
					uni.$u.toast("请填写评论内容.")
					return
				}
				activityApi.saveActivityComment({
					activityId: this.actId,
					content: this.content,
					replyId: this.replyId
				}).then(res=>{
					if (res.success) {
						uni.$u.toast("保存成功.")
						this.$util.goBack()
					}
				})
			},
		}
	}
</script>

<style>
	page{
		background-color: #f7f7f7;
	}
	
	/deep/ .u-textarea {
		padding: 0px !important;
	}
</style>
